<template>
    <div>
         <!-- 面包屑 -->
        <MBX level1='权限管理' level2='权限列表'></MBX>
    <!-- 卡片视图 -->
    <el-card class="mt15">
        <!-- 权限列表 -->
        <el-table border :data='rightsList'>
            <el-table-column type='index' label='#'></el-table-column>
            <el-table-column prop='authName' label='权限名称'></el-table-column>
            <el-table-column prop='path' label='路径'></el-table-column>
            <el-table-column label='权限等级'>
                <template slot-scope="scope">
                    <div>
                       <el-tag :type='typeArr[scope.row.level]'> {{ scope.row.level | rank }}</el-tag>
                    </div>
                </template>
            </el-table-column>
        </el-table>

    </el-card>
    </div>
</template>

<script>
    export default {
        name:'rightslist',
        data() {
            return {
                rightsList:[],
                typeArr:{
                    0:'primary',
                    1:'success',
                    2:'warning'
                }
            }
        },
        created() {
            this.getRightList()
        },
        methods:{
            //获取权限列表方法
           async getRightList() {
              //调用权限接口
             const res=await this.$API.getRightsListAPI()
             console.log('权限列表接口：',res)
             this.rightsList=res;
            }
        }
    }
</script>

<style lang="scss" scoped>

</style>